import React, { Component } from 'react';

import url from '../config/url'
import Pie from '../components/echarts/Pie';
import req from '../http/req'
class Welcome extends Component {



    state = {
        accessFrom: [],
        area: [],
        gender: []

    }


    render() {
        return (
            <div style={{dispaly:'flex'}}>
                <Pie id="pie1"
                    title="会员访问来源饼图"
                    name="来源"
                    data={this.state.accessFrom}
                    legend={false}
                />

                <Pie id="pie2"
                    title="会员所在地区饼图"
                    name="来源"
                    data={this.state.area}
                    legend={false}
                />
                <Pie id="pie3"
                    title="会员性别饼图"

                    name="来源"
                    data={this.state.gender}
                    legend={false}
                />
                <Pie id="pie4"
                    title="会员访问来源饼图"

                    name="来源"
                    data={this.state.accessFrom}
                    legend={false}
                />
                <Pie id="pie5"
                    title="会员访问来源饼图"

                    name="来源"
                    data={this.state.accessFrom}
                    legend={false}
                />

            </div>

        );

    }
    componentDidMount() {
        req.get(url.GetStatData).then((res) => {
            const { accessFrom, area, gender } = res.data.data
            this.setState({
                accessFrom,
                area,
                gender,
            })
        })
    }

}

export default Welcome;
